/**
 * 打开 Sitoy User Manager 视图
 */
package org.hehui.supervisorysystem.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.hehui.supervisorysystem.util.IAppConstants;
import org.hehui.supervisorysystem.util.IImageKey;

/**
 * @author 贺辉
 *
 */
public class OpenSitoyUserManagerViewPartAction extends Action {

	/**
	 * 
	 */
	public OpenSitoyUserManagerViewPartAction() {
		setId("openSitoyUserManagerViewPartAction");
		setText("Sitoy User Manager");
		setToolTipText("Open Sitoy User Manager View Part");
		setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(IAppConstants.APPLICATION_ID, IImageKey.OPEN_SUM_VP));
	}


	@Override
	public void run() {
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		IViewPart view = null;
		try {
			view = page.showView(IAppConstants.SITOYUSERMANAGERVIEWPART_ID);
		} catch (PartInitException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//page.bringToTop(view);
		page.activate(view);
		IWorkbenchAction max = ActionFactory.MAXIMIZE.create(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
		max.run();
		
	}



}
